<template>
  <div>
    <h6 class="mb10" style="text-align: right" v-if="showTime.profitPeriodStart && showTime.profitPeriodEnd">
      {{ showTime.profitPeriodStart }}至{{ showTime.profitPeriodEnd }}
    </h6>
    <div class="box" v-for="(item, index) in profit" :key="index">
      <div class="content1">
        <p v-if="item.projectName">
          {{ item.projectName.trim() }}
        </p>
        <p v-else>--</p>
      </div>
      <div class="content2">{{ item.item }}</div>
      <div class="content3">{{ item.currentAmount }}</div>
      <div class="content4">{{ item.cumulativeAmount }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Profit',
  props: {
    profit: Array,
    showTime: Object,
  },
  data() {
    return {}
  },
}
</script>

<style lang="scss" scoped>
.box {
  @include flex();
  border-left: 1px solid $gray-lighter;
  border-right: 1px solid $gray-lighter;
  border-top: 1px solid $gray-lighter;
  &:last-child {
    border-bottom: 1px solid $gray-lighter;
  }
  > div {
    width: calc(100% / 4);
    height: 40px;
    text-align: center;
    line-height: 40px;
    color: $gray;
    &:not(:nth-child(4n)) {
      border-right: 1px solid $gray-lighter;
    }
    &.content1 {
      background-color: #fafafa;
    }
  }
}
</style>
